<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<script type="text/javascript">
$(function() {
	progressClose();
	
	$('#organizationId').combotree({
        url : '${pageContext.request.contextPath }/sys/organization/tree',
        parentField : 'pid',
        lines : true,
        panelHeight : 'auto'
    });

    $('#roleIds').combotree({
        url: '${pageContext.request.contextPath }/sys/sysRole/tree',
        multiple: true,
        required: true,
        panelHeight : 'auto'
    });

    $('#addForm').form({
        url : '${pageContext.request.contextPath }/sys/sysUser/add',
        onSubmit : function() {
            progressLoad();
            var isValid = $(this).form('validate');
            if (!isValid) {
                progressClose();
            }
            return isValid;
        },
        success : function(result) {
            progressClose();
            result = $.parseJSON(result);
            if (result.success) {
            	parent.$.messager.alert('提示', result.msg, 'info');
                parent.$.modalDialog.openner_dataGrid.datagrid('reload');//之所以能在这里调用到parent.$.modalDialog.openner_dataGrid这个对象，是因为user.jsp页面预定义好了
                parent.$.modalDialog.handler.dialog('close');
            } else {
                parent.$.messager.alert('错误', result.msg, 'error');
            }
        }
    });
    
});
</script>
<div class="easyui-layout" data-options="fit:true,border:false">
    <div data-options="region:'center',border:false" title="" style="overflow: hidden;padding: 3px;">
        <form id="addForm" method="post">
            <table class="grid">
                <tr>
                    <td>登录名</td>
                    <td><input name="loginName" type="text" placeholder="请输入登录名称" class="easyui-validatebox" 
                    	data-options="required:true" value=""></td>
                    <td>姓名</td>
                    <td><input name="realName" type="text" placeholder="请输入姓名" class="easyui-validatebox" 
                    	data-options="required:true" value=""></td>
                </tr>
                <tr>
                    <td>密码</td>
                    <td><input name="loginPwd" type="password" placeholder="请输入密码" class="easyui-validatebox" 
                    	data-options="required:true"></td>
                    <td>性别</td>
                    <td>
                        <select name="sex" class="easyui-combobox" 
                        	data-options="width:140,height:29,editable:false,panelHeight:'auto'">
                            <option value="0" selected="selected">保密</option>
                            <option value="1" >男</option>
                            <option value="2" >女</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td>电话</td>
                    <td><input type="text" name="phone" class="easyui-numberbox"/></td>
                    <td>出生日期</td>
                    <td>
                       <input name="birthday" placeholder="请输入出生日期" 
                    	onclick="WdatePicker({readOnly:true,dateFmt:'yyyy-MM-dd'})" 
                    	value="" readonly="readonly" />
                    </td>
                </tr>
                <tr>
                    <td>用户状态</td>
                    <td>
                        <select id="status" name="status" class="easyui-combobox" 
                        	data-options="width:140,height:29,editable:false,panelHeight:'auto'">
                        	<option value="0">正常</option>
                        	<option value="1">冻结</option>
                        </select>
                    </td>
                    <td>角色</td>
                    <td><select id="roleIds" name="roleIds" style="width: 140px; height: 29px;"></select></td>
                </tr>
                <tr>
                    <td>部门</td>
                    <td colspan="3"><select id="organizationId" name="organizationId" style="width: 140px; height: 29px;" class="easyui-validatebox" data-options="required:true"></select></td>
                </tr>
            </table>
        </form>
    </div>
</div>